package net.wanho.index.controller;
import net.wanho.commons.servlet.BaseServlet;
import net.wanho.systemSettings.po.Employee;
import net.wanho.systemSettings.service.EmployeeService;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet("/ControlServlet")
public class ControlServlet extends BaseServlet<EmployeeService> {
	protected String countAll(HttpServletRequest request,HttpServletResponse response) throws ServletException {
		try {
			HttpSession session = request.getSession();
			Employee employee = (Employee) session.getAttribute("currEmployee");
			//获得当前登录用户的工号
			Integer employeeId = employee.getEmployeeId();
			//调用业务方法 查询控制台
			Map<String, Object> countMap = super.baseService.countAll(employeeId);
			//设置 作用域中
			request.setAttribute("countMap",countMap);
			return "/WEB-INF/index.jsp" ;
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServletException(e.getMessage()) ;
		}
	}
	
}
